<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>常用事件句柄</title>
    <script>
        function f1(){
            console.log("鼠标按键按下时触发");
        }
        function f2(){
            console.log("鼠标按键松开时触发");
        }
        function f3(){
            console.log("键盘上的键按下时触发,识别所有键");
        }
        function f4(){
            console.log("键盘上的键按下时触发,不识别功能键");
        }
        function f5(){
            console.log("键盘上的键松开时触发");
        }
    </script>
</head>
<body>
<button onmousedown="f1()">鼠标按键按下时触发</button><br>
<button onmouseup="f2()">鼠标按键松开时触发</button><br>
<input type="text" onkeydown="f3()"><br>
<input type="text" onkeypress="f4()"><br>
<input type="text" onkeyup="f5()"><br>
</body>
</html>